-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speedup getOrderedReportIDs
by compering strings instead of Dates objects
#28000
Conversation
@Beamanator Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@Szymon20000 @janicduplessis lint is failing |
@mountiny Fixed linting! |
I don't think this pr closes any existing issue. |
That would be great. Just to explain why we did those changes. Then we link it to the performance project. |
Added just one video as the change just optimises sorting and it has to work on all platforms if it works on one. |
Reviewer Checklist
Screenshots/Videos |
Added few comments, but good job! |
I don't see any comments. :D |
src/libs/SidebarUtils.js
Outdated
if (isInDefaultMode) { | ||
nonArchivedReports.sort( | ||
(a, b) => new Date(b.lastVisibleActionCreated) - new Date(a.lastVisibleActionCreated) || a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()), | ||
(a, b) => compareStringDates(a.lastVisibleActionCreated, b.lastVisibleActionCreated) || a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we had new Date(b.lastVisibleActionCreated) - new Date(a.lastVisibleActionCreated)
Please change to: compareStringDates(b.lastVisibleActionCreated, a.lastVisibleActionCreated)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would reverse the order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thats the point how it was done before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then tests won't pass. I can change values in the comparator function but it doesn't make sense for me.
(a, b) => cmp(a, b) is cleaner then (a, b) => cmp(b, a)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I see what you meant. Once we extract it outside of the function it will make sense
@Szymon20000 forgot to request changes... 😄 |
@Szymon20000 Lint is failing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good other than the lint changes!
🎯 @allroundexperts, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #28107. |
@Szymon20000 Lets fix the lint and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for resolving the lint issues, going to merge and deploy the app
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.74-0 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.74-3 🚀
|
Details
For some reason creating Date object is super slow on Hermes. So @janicduplessis came up with the idea to compare strings instead.
Result:
the method now runs under 1s instead of 14s (when starting heavy accounts provided by @danieldoglas)
Fixed Issues
$#28001
$
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android
Simulator.Screen.Recording.-.iPhone.15.-.2023-09-22.at.13.59.47.mp4